package com.zhouheng.springbootmultithreading.tuling.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author  Fox
 */
@RestController
public class StockController {

//    @Autowired
//    private StringRedisTemplate stringRedisTemplate;

    @RequestMapping("/reduce_stock")
    public String reduceStock() {

        //reentrantLock
        //查库存    库存超卖
        /*int stock = Integer.parseInt(stringRedisTemplate.opsForValue().get("stock"));
        if (stock > 0) {
            // 扣减库存
            stock--;
            stringRedisTemplate.opsForValue().set("stock", stock + "");
            System.out.println("扣减成功，库存stock:" + stock);
        } else {
            System.out.println("扣减失败，库存不足");
        }

        return "end";*/
        return "";
    }

}
